#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e4+10;
double K[maxn], E[maxn];
vector<int> G[maxn];
int main() {
    int n; cin >> n;
    for (int i = 0; i < n - 1; ++i) {
        int u, v; cin >> u >> v;
        G[u].push_back(v);
        G[v].push_back(u);
    }
    for (int i = 1; i <= n; ++i) {
        cin >> K[i] >> E[i];
        E[i] /= 100, K[i]/=100;
    }
    return 0;
}